package com.zjdiepu.www.task;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
 * 项目名称：dpqc-parent-manager-schedule <br/> 
 * 类名称：TaskStart <br/>  
 * 类描述： 任务执行入口 <br/>    
 * 创建人：xiongxiaotun <br/> 
 * 创建时间：2017年4月12日 上午9:02:29  <br/>   
 * 修改人：xiongxiaotun <br/> 
 * 修改时间：2017年4月12日 上午9:02:29   <br/>  
 * 修改备注：    <br/> 
 * @version V1.0   <br/>
 */
public class TaskStart {
	private  static final Logger logger = LoggerFactory.getLogger(TaskStart.class);
	
	private AbstractApplicationContext ctx = null;
	
	public static void main(String[] args) {
		TaskStart app = new TaskStart();
		app.init();
		try {
			app.execute();
		} catch (Exception e) {
			logger.error("exception happened at TaskStart.", e);
		} finally {
//			app.destroy();
		}
	}
	
	public void execute() {
		logger.debug("TaskStart is executing now......");
		
		
		// 核心应用
		
		
		logger.debug("TaskStart has executed!");
	}
	
	public void init() {
		logger.debug("TaskStart is starting now......");
		try {
			ctx = new ClassPathXmlApplicationContext("classpath*:spring-diepu-task-tmp.xml");
		} catch (Exception e) {
			logger.error("happened at TaskStart.", e);
		}
		logger.debug("TaskStart has started!");
	}
	
	public void destroy() {
		logger.debug("TaskStart is finishing now......");
		if (null != ctx) {
			ctx.close();
		}
		logger.debug("TaskStart has finished!");
	}
	

}
